package com.hd.view.action;

import com.hd.common.DataPage;
import com.hd.persistence.model.Customer;

/**
 * 客户Action
 * @author jiaoyang
 *
 */
public class CustomerAction extends BaseAction{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Customer customer;
	/*单位名称*/
	private String unitName;
	/*单位简称*/
	private String unitForShort;
	/*单位所在区域*/
	private String district;
	/*单位性质*/
	private String unitKind;
	/*查询的单位结果*/
	private DataPage<Customer> customers;
	/**
	 * 增加新客户
	 * 
	 * @return
	 * @throws Exception
	 */
	public String addNewCustomer() throws Exception{
		return SUCCESS;
	}
	
	/**
	 * 保存新客户
	 * 
	 * @return
	 * @throws Exception
	 */
	public String saveNewCustomer() throws Exception{
		purchaseManager.saveCustomer(customer);
		statusTemp = true;
		return SUCCESS;
	}
	
	/**
	 * 修改客户
	 * 
	 * @return
	 * @throws Exception
	 */
	public String editCustomer() throws Exception{
		return SUCCESS;
	}
	
	/**
	 * 删除客户(可能用不着)
	 * 
	 * @return
	 * @throws Exception
	 */
	public String delCustomer() throws Exception{
		return SUCCESS;
	}
	
	/**
	 * 查询客户
	 * 
	 * @return
	 * @throws Exception
	 */
	public String listCustomer() throws Exception{
		customers = purchaseManager.pageQueryCustomers(getCurrentPage(), pageSize);
		setTotalPage(customers.getTotalPageCount());
		return SUCCESS;
	}
	
	/**
	 * 查看客户信息
	 * 
	 * @return
	 * @throws Exception
	 */
	public String viewCustomer() throws Exception{
		return SUCCESS;
	}

	
/*=========get,set方法========================================*/	
	public Customer getCustomer() {
		return customer;
	}
	
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public String getUnitName() {
		return unitName;
	}

	public void setUnitName(String unitName) {
		this.unitName = unitName;
	}

	public String getUnitForShort() {
		return unitForShort;
	}

	public void setUnitForShort(String unitForShort) {
		this.unitForShort = unitForShort;
	}

	public String getDistrict() {
		return district;
	}

	public void setDistrict(String district) {
		this.district = district;
	}

	public String getUnitKind() {
		return unitKind;
	}

	public void setUnitKind(String unitKind) {
		this.unitKind = unitKind;
	}

	public DataPage<Customer> getCustomers() {
		return customers;
	}

	public void setCustomers(DataPage<Customer> customers) {
		this.customers = customers;
	}
	
	
}
